package com.cc.service.impl;

import com.cc.mapper.ProductMapper;
import com.cc.model.EbProduct;
import com.cc.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;

    @Override
    public List<EbProduct> list(int page, int pageSize) {
        return productMapper.findByPage((page - 1) * pageSize, pageSize);
    }
    @Override
    public int getMaxPage(int pageSize) {
        return productMapper.getMaxPage(pageSize);
    }
    @Override
    public int save(EbProduct ebProduct){

        return productMapper.save(ebProduct);
    }
    @Override
    public EbProduct selectByCondition(Integer ep_id){
        return productMapper.findById(ep_id);
    }
    @Override
    public int updateById(EbProduct ebProduct){

        return productMapper.updateByPK(ebProduct);
    }
    @Override
    public int deleteByPk(int id){
        return productMapper.delete(id);
    }
}

